package com.happymmall.controller.user;

import com.alibaba.fastjson.JSONObject;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

@WebServlet("/user/logout.do")
public class LogoutServlet extends HttpServlet {


    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("application/json;charset=utf-8");

//使用JWT，退出登录只需在前端清除token
        Map<String, Object> resultData = new HashMap();
        resultData.put("status", 0);
        resultData.put("msg", "退出登录成功");

        JSONObject jsonObject = new JSONObject();
        String info = jsonObject.toJSONString(resultData);
        PrintWriter out = resp.getWriter();
        out.write(info);


    }
}
